
const state = () => ({
    token: '',
    agentNo: '',
    name: '',
    avatar: '',
	os:'',
	version:'',
    userInfo: {
        agentBean:{},
        costBeanList:[],
        enterpriseBean:{},
        settleInfoBean:{},
    },
    bindStatus: false,
	invitation:''
})

const getters = {}

const mutations = {
    SET_TOKEN(state, token) {
        state.token = token
    },
    SET_AGENTNO(state, agentNo) {
        state.agentNo = agentNo
    },
	SET_OS(state, os) {
	    state.os = os
	},
	SET_VERSION(state, version) {
	    state.version = version
	},
    SET_NAME(state, name) {
        state.name = name
    },
    SET_INFO(state, info) {
        state.userInfo = info
    },
    SET_BIND_STATUS(state, bindStatus) {
        state.bindStatus = bindStatus
    },
	SET_Invitation(state, invitation) {
	    state.invitation = invitation
	}
}

const actions = {
    async GetUserInfo({ state, commit }, value) {
        commit('SET_TOKEN', value)
    },
	async GetInvitation({ state, commit }, value) {
	    commit('SET_Invitation', value)
	},
	
	async GetOs({ state, commit }, value) {
	    commit('SET_OS', value)
	},
	async GetVersion({ state, commit }, value) {
	    commit('SET_VERSION', value)
	},
    async GetUserInfo1({ state, commit }, value) {
        commit('SET_AGENTNO', value)
    },
    async GetUserAllInfo({ state, commit }, value) {
        commit('SET_INFO', value)
    },
	async GetUserInfo({ state, commit }, value) {
	    commit('SET_TOKEN', value)
	},
	async GetUserInfo({ state, commit }, value) {
	    commit('SET_TOKEN', value)
	},
    LogOut({ commit }) {
        return new Promise(resolve => {
            commit('SET_TOKEN', '')
            commit('SET_NAME', '')
            commit('SET_AVATAR', '')
            resolve(1)
        })
    }
}

export default {
    namespaced: true,
    state,
    getters,
    actions,
    mutations
}
